﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <string>
using namespace std;

class BuildingFriend;
class goodGay
{
public:
	goodGay();
	void visit();
private:
	BuildingFriend* buildingFriend;
};

class BuildingFriend
{
	//2.让好基友类goodGay，作为BuildingFriend的好朋友；
	friend class goodGay;
public:
	BuildingFriend();
	//1.客厅，卧室；
public:
	string m_SittingRoom;
private:
	string m_BedRoom;
};

goodGay::goodGay()
{
	buildingFriend = new BuildingFriend;
}

void goodGay::visit()
{
	cout << "好基友正在访问：" << this->buildingFriend->m_SittingRoom << endl;
	cout << "好基友正在访问：" << this->buildingFriend->m_BedRoom << endl;
}

BuildingFriend::BuildingFriend()
{
	this->m_SittingRoom = "客厅";
	this->m_BedRoom = "卧室";
}

void testFriendClass()
{
	goodGay gg;
	gg.visit();//好基友正在访问：客厅  
	//好基友正在访问：卧室
}

//main274：整个类作为友元类
int main274()
{
	testFriendClass();

	system("pause");
	return EXIT_SUCCESS;
}